export const getDateFormat = (content: string) => {
  const reg = content.replace(/\s/gi, '').matchAll(/(\d{4})年(\d{1,2})月(\d{1,2})日/g)
  let date = ''
  for (const r of reg) {
    const [_, y, m, d] = r
    date = [y, m, d].join('-')
  }
  return date
}

export const getDatesInRange = (startDate: Date, endDate: Date) => {
  const dateArray = [] as Date[]
  let currentDate = new Date(startDate)

  while (currentDate <= endDate) {
    dateArray.push(new Date(currentDate))
    currentDate.setDate(currentDate.getDate() + 1)
  }

  return dateArray
}
